home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Mac Game Programming Gurus / TricksOfTheMacGameProgrammingGurus.iso / More Source / Pascal / Skel 3.0i / Skel redraw.p < prev    next >
Encoding:
Text File  |  1994-04-18  |  1.6 KB  |  56 lines  |  [TEXT/PJMM]

  1. unit Redraw;
  2.  
  3. interface
  4.     uses
  5.         Globals;
  6.  
  7.     procedure DrawWindow;
  8.  
  9. implementation
  10.  
  11. {Redraw my window}
  12. {############################   DrawWindow   #############################}
  13.  
  14. {   We draw all the contents of our one window, myWindow.  Note that this}
  15. {   must include scroll bar areas and the grow icon; the Window Manager}
  16. {   will NOT Handle those for us. Since there are no scroll bars, we}
  17. {   must erase the Region they would be in.  Echh.}
  18.  
  19.     procedure DrawWindow;
  20.         var
  21.             arect: Rect;            (* rectangle to erase *)
  22.             thePat: PixPatHandle;
  23.     begin
  24.  
  25.         if gColorQDFlag then
  26.             begin
  27.                 thePat := GetPixPat(patID);
  28.                 FillCRect(mywindow^.portRect, thePat);
  29.                 DisposePixPat(thePat);
  30.             end
  31.         else
  32.             begin
  33.                 thePat := PixPatHandle(GetResource('ppat', patID));
  34.                 FillRect(mywindow^.portRect, thePat^^.pat1Data);
  35.                 ReleaseResource(Handle(thePat));
  36.             end;
  37.  
  38.         if false then
  39.             FillRect(mywindow^.portRect, dkGray);
  40.                 (*  first, fill the window with dark gray; this fills scroll bars, too *)
  41.  
  42. (*  second, erase the scroll bars and draw the grow icon *)
  43.  
  44. (*  erase the horizontal scroll bar *)
  45.         SetRect(arect, mywindow^.portRect.left, mywindow^.portRect.bottom - 15, mywindow^.portRect.right - 15, mywindow^.portRect.bottom);        (* cover the horizontal bar *)
  46.         FillRect(arect, white);    (* fill with white *)
  47.  
  48. (*  erase the vertical scroll bar *)
  49.         SetRect(arect, mywindow^.portRect.right - 15, mywindow^.portRect.top, mywindow^.portRect.right, mywindow^.portRect.bottom - 15);        (* cover the vertical bar *)
  50.         FillRect(arect, white);    (* fill with white *)
  51.  
  52.         DrawGrowIcon(mywindow);    (* draw the size box in the corner of the window *)
  53.  
  54.     end;                (* DrawWindow *)
  55.  
  56. end.